﻿using CampusTrade.Dao;
using CampusTrade.Pojo;
using Furion.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace CampusTrade.Service
{
    public class TransactionService : ITransient
    {
        private readonly TransactionDao transactionDao;
        public TransactionService(TransactionDao transactionDao)
        {
            this.transactionDao = transactionDao;
        }

        public long addTransaction(Transaction transaction)
        {
            return transactionDao.add(transaction);
        }
        public int delTransaction(long id)
        {
            return transactionDao.delete(id);
        }
        public Transaction getTransactionDetail(long id)
        {
            return transactionDao.select(id);
        }

        public List<Transaction> getSellList(long uid)
        {
            return transactionDao.mySellList(uid);
        }

        public List<Transaction> getBuyList(long uid)
        {
            return transactionDao.myBuyList(uid);
        }
    }
}
